A finite-state machine (FSM), or simply a state machine, is a mathematical model used to design computer programs and digital logic circuits, among other things. A state machine can change or transition from one state to another when a condition is met.